var conection_fa;
function loadFileAcceptFriend(url) 
{
  if(url=='')
  {
        return;
  }
  
  conection_fa=postRequest();
  conection_fa.onreadystatechange = procesarEventosAF;
  //conection_fa.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  conection_fa.open("GET", url, true);
  conection_fa.send(null);
}

function procesarEventosAF()
{
	
  if(conection_fa.readyState == 4)
  {
	  accepted(conection_fa.responseText);
  }else{
	 
  } 
}   
function accepted(str){
    if(str=="yes"){
	alert('Usuario agregado ');
	init_users_petitions();
	init_user_friends();
	init_users();
	}else{
		alert('Se ha presentado algun problema. Intentar mas tarde');
        }
 }
   
    function acceptFriend(formname){
    	resp=confirm("Enviar Peticion") 
	if(resp) 
	{  
	    var id = document.forms[formname].elements['id'].value;
        var user_id = document.forms[formname].elements['user_id'].value;
        var url = "accept_friend.php?id="+id+"&user_id="+user_id ;
        loadFileAcceptFriend(url);
	}
	else
		return false;	       
}